REM JACK DEMO
REM COPYRIGHT 1992 JAMES A. SAUSVILLE
REM ALL RIGHTS RESERVED
REM THIS DEMO IS DISTRIBUTED AS A PART OF THE GRAPHICS FACTORY (1.0).
REM IT IS INTENDED TO SHOW HOW GRAPHICS MAY BE USED IN YOUR OWN PROGRAMS.
REM THIS PROGRAM INTENTIONALLY AVOIDS USING STRUCTURED PROGRAMMING TECHNIQUES
REM TO INCREASE CLARITY.

SCREEN 9

REM PLEASE NOTE THIS PROGRAM CONTAINS NO ERROR TRAPPING

REM THE SET FILE MAY BE USED TO CHANGE THE PALETTE AND DIMENTION THE STORAGE
REM ARRAY FOR THE GRAPHICS

DIM SET%(19)

FILE$ = "JACKDEMO.SET"
DEF SEG = VARSEG(SET%(0))
BLOAD FILE$, VARPTR(SET%(0))
DEF SEG

NumFrames% = SET%(0)  ' THE NUMBER OF GRAPHICS STORED
ELEMENTS% = SET%(3)   ' THE SIZE/OFFSET OF THE GRAPHICS

REM CHANGE THE PALETTE TO THE ONE STORED IN THE SET FILE

DIM CURPAL%(15)

FOR LLL = 0 TO 15
CURPAL%(LLL) = SET%(4 + LLL)
NEXT LLL
PALETTE USING CURPAL%

REM DIMENSION THE ARRAY FOR THE GRAPHICS

DIM JACK%(NumFrames% * ELEMENTS%)

FILE$ = "JACKDEMO.GF"
DEF SEG = VARSEG(JACK%(0))
 BLOAD FILE$, VARPTR(JACK%(0))
DEF SEG

REM DEFINE AN ANIMATION SEQUENCE FOR THE FRAMES.

A$ = "01 01 02 02 03 03 04 04 01 01 02 02 03 03 04 04 01 01 02 02 03 03 04 "
B$ = "04 01 01 02 02 03 03 04 04 05 06 07 08 09 10 11 12 13 14 15 16 17 17 "
C$ = "16 16 17 17 16 16 17 17 16 16 17 17 17 17 17 "
ANIM$ = A$ + B$ + C$

REM MAIN ANIMATION LOOP

MAINTOP:

FOR LLL = 1 TO LEN(ANIM$) STEP 3

FRAME$ = MID$(ANIM$, LLL, 2)
FRAME% = VAL(FRAME$)
PUT (300, 175), JACK%((FRAME% - 1) * ELEMENTS%), PSET

GOSUB DELAY: ' REM IN A STUCTURED PROGRAM YOU SHOULD NOT USE GOSUB- SEE BELOW

K$ = INKEY$             'READ THE KEYBOARD
IF K$ = " " THEN END    'END IF [SPACE] IS PRESSED

NEXT LLL

GOTO MAINTOP:

END

DELAY:

REM SHOULD BE REPLACED BY- CALL DELAY(SECONDS!)

SECONDS = .2
TIME = TIMER
XDELAY = TIME + SECONDS
WHILE NOT (TIMER > XDELAY)
WEND

RETURN


